package yf.mall.vo.app.common;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;

import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @program: fly-boot
 * @ClassName ListResult
 * @description:
 * @author: yxmds
 * @create: 2023-07-11 15:58
 * @Version 1.0
 **/
@Data
public class ListResult<T> {

    @JSONField(name = "data")
    @Valid
    private List<T> data = new ArrayList<>();

    @JSONField(name = "hasMore")
    private Boolean hasMore;

    public static final ListResult emptyResult = new ListResult(Collections.emptyList(),false);

    public ListResult(List<T> data, Boolean hasMore) {
        this.data = data;
        this.hasMore = hasMore;
    }
}
